home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
database
/
dmetclip
/
cometmp.doc
next >
Wrap
Text File
|
1991-02-06
|
75KB
|
3,037 lines
**** DEMO Copy *** DEMO Copy *** DEMO Copy *** DEMO Copy ****
* *
* COMET-MP: the Background Communications Library *
* *
* by CompuSolve 88 Erie Ave Rockaway, NJ 07866 *
* (201)983-9429 *
*************************************************************
This manual and associated software for COMET-MP is provided as
a demonstration/evaluation copy. It's only limitation is
that file transfers are limited to 2k (2048 bytes) in size.
Any file transfer commands encountering a file size that
exceeds this 2k demo limit will automatically cancel.
Once you're impressed with COMET's abilities you can order
it directly from CompuSolve by phone (VISA-MC-AMEX) or
send a check for $169 to receive the latest copy of the
product and a manual. Of course we'll remove the 2k limit
for those of you that order! COMET is sold ROYALTY FREE so
the necessary COMET.BIN or linked COMET.OBJ can be included
with all your applications at no additional cost.
There are two versions of COMET available, a single port version
called COMET and the multi-port version called COMET-MP which can
support up to 5 COM ports simultaneously, all in the BACKGROUND.
This demo package contains the COMET-MP version. The single port
version sells for $99.00 .
This manual has been generated with 66 lines/page.
C O M E T - M P
Copyright (c) 1989 - 1991 by CompuSolve
All Rights Reserved
CompuSolve
88 Erie Avenue
Rockaway, NJ 07866
U.S.A.
Tele: (201)983-9429
Support: (201)983-9429
BBS: (201)983-9426
FAX: (201)627-1028
rev 1.0
Table Of Contents
Warranty ....................................... 1
License ........................................ 2
Technical Support .............................. 3
Installation ................................... 4
Introduction ................................... 5
Getting Started ................................ 6
Conventions .................................... 7-8
Commands - General ............................. 9
Commands:
ARECV ........................................ 10
ARECVA ....................................... 10
ASEND ........................................ 11
BUFFER ....................................... 12,13
CLOSE ........................................ 14
DTR .......................................... 15
FCHK ......................................... 16,17
FIND ......................................... 18
FINDI ........................................ 18
FLAVOR ....................................... 19
FLUSH ........................................ 20
INPUT ........................................ 21,22
MSTAT ........................................ 23
ONDCD ........................................ 24,25
ONDONE ....................................... 26
ONTIME ....................................... 27
OPEN ......................................... 28,29
OUTPUT ....................................... 30
RTS .......................................... 31
RXCNT ........................................ 32
STAT ......................................... 33
TXCNT ........................................ 34
VERS ......................................... 35
XRECV ........................................ 36
XSEND ........................................ 37
YRECV ........................................ 38
YSEND ........................................ 39
Troubleshooting ................................ 40
Error Codes .................................... 41
Appendix A (Auxilary-Byte Table) ............... 42
Appendix B (Clipper Event Trapping Notes) ...... 43
WARRANTY
Thank you for purchasing the COMET communication library!
CompuSolve offers a no nonsense money back guarantee to original
owner's of COMET. You may return the entire software package
within the first 30 days of purchase for a full refund, for any
reason. If you bought COMET directly from CompuSolve you'll need
to call and get a return authorization number before sending any
materials back. If purchased from a mail order firm or elsewhere
you'll need to contact them directly for return information and
policies.
While every effort has been made to make COMET reliable and bug
free, no software publisher can guarantee 100% bug free software.
CompuSolve will make every effort to investigate bug reports,
offer work around solutions and promptly offer software fixes at
no additional charge.
- 1 -
LICENSE
Compusolve grants the original purchaser an unlimited duration
license to use COMET software under the following terms and
conditions:
1) When developing application software using the COMET software
library and associated manual, only one PC is to have COMET
installed at any given time. Multiple copies of the COMET
libraries and documentation are prohibited.
2) After developing an application, you are entitled to provide
the COMET library file only along with the rest of your
application's programs. For Clipper applications the
COMET.OBJ library file is directly linked in to produce
executable programs so no COMET files are to be distributed.
Interpretative dBASE languages should only have the COMET.BIN
library file distributed with the application programs. In no
instance should the distributed COMET.BIN library file be
renamed.
Those not willing to agree to the above license terms should
return COMET within the first 30 days of purchase for a full
refund.
- 2 -
TECHNICAL SUPPORT
Telephone: (201)983-9429
Phone support is free for the first 60 days to all registered
owners. Beyond the first 60 days, there is a charge of $20 per
call or a yearly support plan costing $55 (Amex, MC and VISA)
Bulletin Board (BBS): (201)983-9426
Unlimited free technical support is available through the use of
our 24 hour a day bulletin board. The board operates at 1200 or
2400 baud, 8 data bits, no parity and 1 stop bit (a perfect use
for the sample terminal emulation program that's included with
COMET).
After logging on to the system, leave your questions or comments
as E-mail to the SYSOP.
FAX: (201)627-1028
Also, unlimited free support is provided when inquiries are
directed to our FAX machine which is operative 24 hours a day.
- 3 -
INSTALLATION
1) Insert the COMET product diskette into any floppy drive.
2) Change to the hard disk directory where you want the COMET
files to be installed using DOS's "CD" command.
3) Assuming you've put the COMET diskette in drive A, run one of
the install programs listed below for your database language:
A:CMETCLIP - Clipper (all versions)
or
A:CMETD3FX - dBASEIII, FoxBase, QuickSilver and compatibles
or
A:CMETD4FP - dBASEIV AND FoxPro
Example 1:
C:
CD\CLIPPER
A:CMETCLIP
Example 2:
D:
CD\FOXPRO
A:CMETD4FP
Example 1 would install the Clipper version of COMET into the hard
disk's C:\DATABASE directory whereas example 2 would install the
dBASEIV/FoxPro version into D:\FOXPRO
- 4 -
INTRODUCTION
COMET-MP is an add on communications library compatible with
dBASEIII/IV, FoxBase/Pro, Clipper S87/5.0, dBXL and QuickSilver.
COMET extends these database languages by adding powerful
communications capabilities. One of COMET's most unique features
is that all of its commands operate entirely in the background
leaving your program free to do other tasks. No longer do you
have to wait for lengthy file transfers to complete before being
returned to your database application. Imagine a data entry
person posting invoices while COMET handles incoming modem calls
and performs file transfers, all in the background!
COMET-MP (multi-port) supports the simultaneous use of
upto 5 COM ports. With user defined I/O port addresses and
interrupts, COMET-MP will work on virtually any IBM PC compatible
RS232 hardware including boards manufactured by companies such as
DigiBoard and AST Research.
This manual assumes the reader is somewhat familiar with serial
communications and its terminology (ie. baud rate, parity, COM
port etc.). Those not familiar with such terms should refer to
appropriate books on the subject. In addition, those intending to
do modem communications are well advised to obtain a copy of the
reference manual for their particular modem for an explanation of
modem configurations and command sets.
- 5 -
Getting Started
While COMET is primarily intended for use within a database
program, it will also work from the dot prompt of any of the
database languages with the exception of Clipper, as it is a
compiled language (Clipper developers: link COMET with Nantucket's
DOT.PRG to test from a dot prompt environment).
In fact, using COMET from the dot prompt is one of the best ways
for programmers to familiarize themselves with COMET. The
following few lines demonstrate how easy it is to OPEN a COM port
(COM1) with a Hayes compatible modem attached, then have the modem
dial a number:
. LOAD COMETMP && Not needed for Clipper
. OpenCmd = 'OPEN COM1:2400,N,8,1,N'
. CALL COMETMP WITH OpenCmd
. Dial = 'OUTPUT #1,ATDT123-4567' + CHR(13)
. CALL COMETMP WITH Dial
Now we'll CLOSE COM1 and force modem to disconnect:
. ClsCmd = 'CLOSE #1'
. CALL COMETMP WITH ClsCmd
In addition to testing COMET from the dot prompt, you may want to
run and later examine the sample program TERMINAL.PRG which is a
simple terminal emulation program demonstrating many of COMET's
commands.
NOTE: Clipper users will need to first compile and then link the
sample program as follows:
a) CLIPPER TERMINAL.PRG (compiles program)
b) Using PLINK86 or RTLINK to link:
=>FILE TERMINAL.OBJ, COMETMP.OBJ
=>OUTPUT TERMINAL.EXE
=>LIB CLIPPER, EXTEND
- 6 -
COMMANDS - CALLING CONVENTIONS
The following section describes COMET's command set. All of the
commands are invoked by using the CALL ... WITH command syntax
supported by each database language.
The basic format of the CALL statement is:
CALL COMETMP WITH <varC>
On Entry:
<varC> is a character variable consisting of the following:
1) The name of the COMET command to perform (required)
2) Port#(1-5) followed by a comma (command dependent)
3) Command parameters/arguments (command dependent)
On Return:
In order to pass results or data back to the database program,
COMET modifies a portion of <varC>'s contents after performing the
requested command. Using a database SUBSTR function, one can
extract the returned information from <varC>. This returned data
always starts immediately after the comma which seperates the port
# from the rest of the command parameters.
NOTE: COMET will never increase the length of <varC> in order to
return data. If <varC> is not long enough, COMET simply truncates
the data being returned. If COMET increased <varC>'s length, the
database language's internal variable memory map could be
corrupted.
Errors:
If COMET is passed an invalid command name or parameter, then the
first one or two characters of <varC> will be modified with an
appropriate error code as detailed in appendix A. A simple way
then to test whether COMET is reporting an error is to compare the
first two letters of returned <varC> against the first two letters
of the command name requested.
NOTE: It is highly recommended that you implement a single
procedure or function to do all CALLs to COMET. In addition to
performing the actual CALL using the procedure's parameters, it
should test for any COMET reported errors as described above.
- 7 -
COMMANDS - CALLING CONVENTIONS (cont'd)
Example 1:
* Open and initialize COM port #1 for use
OpenCmd = "OPEN COM1:2400,N,8,1"
CALL COMETMP WITH OpenCmd
*Now test for an error by testing 1st two chars of OpenCmd
OpenWasOK = IIF(OpenCmd = "OP", .T., .F.)
*If OPENed ok, send text "Hello World" and CR/LF
IF OpenWasOK
OutputCmd = "OUTPUT #1,Hello World" + CHR(13) + CHR(10)
CALL COMETMP WITH OutputCmd
ELSE
? "COMET OPEN command failed!"
ENDIF
Example 2:
*This code demonstrates the recommended way to perform all COMET
*commands using a centralized CALLing procedure approach that
*tests for COMET reported errors.
OpenWasOk = COMET_CALL("OPEN COM1:2400,N,8,1")
IF OpenWasOk
OutputOk = COMET_CALL("OUTPUT #1,Hello World" +CHR(13) + CHR(10))
ELSE
? "COMET OPEN command failed!"
ENDIF
.
.
.
FUNCTION COMET_CALL && PROCEDURE stmt if dBASEIII/FoxBase
PARAMETERS CometCmd
* Save 1st 2 letters of command name so we can test for errors
Command1_2 = LEFT(CometCmd, 2)
CALL COMETMP WITH CometCmd && Perform COMET command
*Now see if COMET reported any errors
Ok = IIF(CometCmd = Command1_2, .T., .F.)
RETURN Ok && Return command success/failure
- 8 -
COMMAND REFERENCE FORMAT:
The following describes notation conventions used throughout the
command reference section of this manual.
ENTRY: - Specifies the required syntax and format of the character
type variable passed to COMET for a particular command.
<varC> - The character type variable that must be passed following
the WITH clause of the CALL statement. This character expression
is usually a variable rather than a constant so that data or error
messages from COMET can be retrieved.
RETURN: - Specifies the contents of <varC> after COMET has updated
the variable with any results/data being returned.
[ ] - Used to indicate either optional command parameters that
can be supplied upon entry, or data that might be returned by
COMET depending on circumstances. The brackets are not part of
<varC> unless explicitly stated for a given command.
| - Means OR, indicating that 1 or more choices exist.
eg. Expr1 | Expr2 means expression1 OR expression2 can be
used.
NOTE:
Parameters that require numeric values as part of <varC> can be
entered in decimal or hexadecimal format. Decimal is assumed by
default unless a number is preceded by an "x" or "X".
eg. 100 = decimal 100
x100 = decimal 256 (hex 0100)
- 9 -
COMMAND: ARECV and ARECVA
ENTRY: <varC> = "ARECV|ARECVA #P, filespec [,timeout]"
#P = desired port # (1-5)
filespec = DOS path\filename
timeout = # seconds before auto-close (0 - 3600)
RETURN: <varC> unchanged unless error
ERROR CODES: (See appendix A for general error codes)
"xx" - port not OPEN
"-" - busy (previous file transfer still active)
SEE ALSO: ASEND, FCHK, FLUSH, OPEN
PURPOSE:
Used to begin capturing of incoming COM port data into a specified
file. ARECV creates a new file overwriting any existing file of
the same name, whereas ARECVA appends to an existing file. The
optional timeout parameter specifies the duration of COM port
receiver inactivity before automatically closing the file and
canceling the capture. The default timeout is 60 seconds.
Specify a value of 0 to disable auto-close feature. Other than a
timeout, there are two other ways the file can be closed; if a DOS
End-Of-File (EOF = 1Ah = 26d) character is received or a FLUSH
command is given for this COM port. When capturing is in progress
the COM port data can also be read from the receive buffer using
the INPUT command. ARECV will use flow control to insure no data
is lost if the OPEN command has specified either Xon/Xoff or
Rts/cts methods. Use FCHK to determine the number of bytes
captured at any time as well as determine if any data loss has
occurred. Unlike the XModem and Ymodem commands, ARECV will allow
OUTPUTting of data to the port even while capture is in progress.
EXAMPLE:
* Initiates capturing of port #1 data to a new file with a default
* 60 second timeout.
RecvCmd = 'ARECV #1,\MYDIR\MYFILE.RCV'
CALL COMETMP WITH RecvCmd
* Initiate capture, but append to existing file and no timeout.
RecvCmd2 = 'ARECVA #1,\DBASE\CAPTURE.TXT,0'
CALL COMETMP WITH RecvCmd2
- 10 -
COMMAND: ASEND
ENTRY: <varC> = "ASEND #P,filespec"
#P = desired port # (1-5)
filespec = DOS path\filename
RETURN: <varC> = unchanged unless error
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer already active)
SEE ALSO: ARECV, FCHK, FLUSH, OPEN
PURPOSE:
Used to begin sending of a file out the specified COM port. No
error checking protocol is used as the file is simply copied out
the port. Use only when either errors can be tolerated (eg. text
files), sender and receiver are directly wired together, or some
type of error correcting modems are in use. Although this command
is normally used to send ASCII rather than binary files, all
characters will be sent including control characters. It is the
size of the file that determines when ASEND completes. ASEND will
respond to flow control if the port was OPENed with either
Xon/Xoff or Rts/cts specified. Use FCHK to determine the number
of bytes sent so far. Unlike the XModem and Ymodem commands,
ASEND will allow INPUTting of data from the port even while
sending is in progress. To cancel ASEND at any time, issue a
FLUSH command.
EXAMPLE:
* Send a file out port #1
SendCmd = 'ASEND #1,\MYDIR\MYFILE'
CALL COMETMP WITH SendCmd
*Note how COMET returns immediately while file gets sent in the
*background.
*Some time later, get file status
SendChk = 'FCHK #1,' + SPACE(80)
CALL COMETMP WITH SendChk
@ 24, 0 SAY SendChk && Display current status
- 11 -
COMMAND: BUFFER
ENTRY: <varC> = "BUFFER #P, [seg: len]"
#P = desired port # (1-5)
seg = segment address for start of buffer
len = length of buffer in bytes (must be > 1024d)
RETURN: <varC> = unchanged unless error
ERROR CODES: (See appendix A for general error codes)
"?s" = Illegal/missing segment address
"?l" = Illegal/missing length
SEE ALSO: OPEN
PURPOSE:
This command allows the default buffer size and/or location to be
overridden for the specified port. By default COMET reserves 1024
bytes for each port's buffer. This buffer space is used for:
1) All received data, including file receive operations
2) Data being transmitted, only for file send operations
In some cases the 1024 byte buffer may be too small resulting in
lost data as can be determined by FCHK's or RXCNT's buffer
overflow error messages. In most buffer overflow cases though,
the problem can easily be solved by specifying some form of flow
control in the OPEN command. If the sending device doesn't
support flow control, then increasing the buffer size may be the
only solution.
There are 2 ways to specify a custom buffer location/size:
All Languages:
If a segment address and buffer length are given, COMET will use
memory starting at seg:0000 for a length of len bytes for the
port's buffer. No checking is done to see if this memory
requested conflicts with other programs, so be sure the region
specified is unused. This allows one to create very large buffers
in DOS's high memory area without reducing the amount of
conventional memory available to DOS and programs. The largest
length for any one buffer is 64k (65536 bytes).
Clipper ONLY:
If only a length parameter is passed, COMET will request a
memory block from DOS that is len bytes long.
eg. <varC> = "BUFFER #1, x1000" will attempt to establish a new
buffer that is 1000h (4096d) bytes in size.
- 12 -
COMMAND: BUFFER (cont'd)
EXAMPLE:
*Method 2 - create new buffer starting at C000:0000 for 8000
*bytes (8000 decimal, could also have been x2000)
HiMemBuff = "BUFFER #1, xC000: 8000"
CALL COMETMP WITH HiMemBuff
NOTE:
Segment and length values may be in either heXidecimal or decimal
format. Hexadecimal numbers must be preceded by an upper or
lowercase x.
When a port gets CLOSEd, any custom buffer information is lost and
must be specified again after the port is once again OPENed.
- 13 -
COMMAND: CLOSE
ENTRY: <varC> = "CLOSE [#P]"
#P = desired port # (1-5)
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
SEE ALSO: FLUSH, OPEN
PURPOSE:
To shut down one or all currently OPENed COM ports. If no #P
parameter specified, then all OPEN ports will be closed and no
longer available until reOPENed. Any ports closed will have their
respective Data Terminal Ready (DTR) and Clear-To-Send (CTS)
outputs turned off. Additionally, if the port(s) have active file
transfers going on, these will be terminated and files closed. It
is a good practice to issue the CLOSE command before exiting or
QUITing from your database program, even though COMET
automatically closes ports and files when exiting.
EXAMPLE:
* Let's shut down just port #4
Clos4 = "CLOSE #4"
CALL COMETMP WITH Clos4
* Let's shut down all OPEN ports
ClosAll = 'CLOSE'
CALL COMETMP WITH ClosAll
- 14 -
COMMAND: DTR
ENTRY: <varC> = "DTR #P,n"
#P = desired port # (1-5)
n = 0 or 1
RETURN: <varC> = unchanged
PURPOSE:
To set the state of the COM port's Data Terminal Ready (DTR)
output signal. Specify 1 to set the signal active, 0 to disable.
By default, the signal is set to an active (1) state after the COM
port is OPENed. Data Terminal Ready is output from the PC's
serial COM port to whatever device is attached to the port. If a
modem is attached, this signal is normally required to be at an
active (1) state before the modem will respond to any commands it
receives. Furthermore most Hayes compatible modems will
automatically disconnect from the telephone line if Data Terminal
Ready should change from a 1 to a 0 state during a call. With
modems then, the DTR command is a simple way to force a modem to
disconnect or hangup.
EXAMPLE:
DTROn = 'DTR #2,1'
DTROff = 'DTR #2,0'
CALL COMETMP WITH DTROn && Set DTR active
CALL COMETMP WITH DTROff && Now, turn DTR off
NOTE: Some modems have a dip switch or configuration setting that
can override the Data Terminal Ready disconnect feature. Consult
your modem's manual for details.
- 15 -
COMMAND: FCHK
ENTRY: <varC> = "FCHK #P," + SPACE(80)
#P = desired port # (1-5)
RETURN: <varC> = "FCHK #P,prot,dir,stat,size,file [warn][fail]"
prot = "ASCII ", "XMODEM" or "YMODEM" ( 9, 6)
dir = "RECEIVE " or "TRANSMIT" (16, 8)
stat = "ACTIVE ", "COMPLETE" or "FAILED " (25, 8)
size = "#######" (bytes rec'd or sent) (34, 7)
file = path\name of file (42, ?)
[warn] = [DATA LOSS]
[fail] = [CANCELED], [DATA ERRORS], [FILE: OPEN READ],
[FILE: WRITE], or [TIMEOUT]
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
SEE ALSO: ARECV, ASEND, XRECV, XSEND, YRECV, YSEND
PURPOSE:
To determine the file transfer status of a specified port. FCHK
reports the active file transfer protocol, direction, status, size
in bytes transfered so far, file path/name and possible warning or
failure messages. Except for the possible warning and failure
messages, each value returned has a fixed starting position and
length within <varC> to simplify extracting when using the SUBSTR
function. Note that both the delimiting commas and brackets are
returned in <varC>. Once FCHK reports a finished status (ie.
COMPLETE or FAILED), subsequent calls to FCHK will report the word
"IDLE" to indicate that no file transfer is active until another
file transfer command gets issued. Since COMET does not directly
display file transfer status, one use for FCHK would be to
periodically display this status. Used in conjunction with the
ONTIME command, it is possible to automatically do a procedure
that displays current FCHK values every so often. When FCHK
reports a FAILED status, [fail] will contain one of the following
messages indicating the reason for failure:
[CANCELED] - File transfer got canceled by either a FLUSH
command or receiver/sender requested cancel.
[DATA ERRORS] - Too many data related errors occurred probably
due to noisy phone line when modems are involved.
[FILE: OPEN/READ] - Couldn't open requested file or a non
recoverable disk read error.
[FILE: WRITE] - Non recoverable disk write error
[TIMEOUT] - Receiver/sender fails to respond. With ARECV,
indicates no data has been received for 60 seconds or
user specified timeout value.
- 16 -
COMMAND: FCHK (cont'd)
In addition, a warning message of "[DATA LOSS]" may be returned if
the file protocol was ARECV and data was lost due to buffer
overflow. If this warning occurs, you may need to implement some
form of flow control for this port (see OPEN).
NOTE:
The length of <varC> required to fit all of FCHK's returned values
will vary depending on the file path/name. Be sure to allow
sufficient space or COMET will truncate items.
EXAMPLE:
StatCmd = 'FCHK #1,' + SPACE(80)
CALL COMETMP WITH StatCmd
Stus = SUBSTR(StatCmd,25,8) && Extract status
Cnt = SUBSTR(Statcmd,34,7) && Extract byte count
Last3 = SUBSTR(StatCmd,42) && File name + [fail] + [warn]
SpcAt = AT(' ',Last3) && Find space after path\file name
FName = SUBSTR(Last3,SpcAt-1) && Now we have path\file name
@ 24,0 SAY 'File:' + FName
@ 24,15 SAY 'Status: ' + Stus
@ 24,30 SAY '# Bytes: ' + Cnt
.
- 17 -
COMMAND: FIND and FINDI
ENTRY: <varC> = "FIND|FINDI #P, string"
#P = desired port # (1-5)
string = character(s) to find
RETURN: <varC> = "FIND|FINDI #P,?string"
? = plus sign(+) if string found; space if not found
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
To search COMET's receive buffer for a character string. If
string is found, the space character following #P, will be
replaced with a plus sign character, "+". The FINDI form of the
command specifies a case Insensitive search. If found, the buffer
pointer advances to the first character of string essentially
skipping over any characters prior to string that hadn't been read
from the buffer. This leaves the buffer pointer set so that the
next INPUT command would return data starting with string.
If string can't be found, <varC> will remain unchanged so that the
repeated CALLs to COMETMP can be made with the same <varC> until a
"+" is reported.
EXAMPLE:
* Assume buffer holds: "abcdeFghijk"
* Do a case insensitive search for "DEF"
FindCmd = "FINDI #1, DEF"
* Stay in a loop till "DEF" found
DO WHILE .NOT. '+' $ FindCmd && Loop till found
CALL COMETMP WITH FindCmd
ENDDO
* FindCmd now = "FINDI #1,+DEF"
* FIND moved pointer so buffer now holds: "deFghijk"
* Now let's read in upto 10 chars from buffer
* COMET replaces the xxxxx with the # chars returned from buffer
Inp = "INPUT #1, xxxxx" + SPACE(10)
CALL COMETMP WITH Inp
* Inp now = "INPUT #1, 00008deFghijk "
NOTE: <varC> must contain a space after #P, which will be a place
holder for the plus sign if string is found. This space is not
going to be included in the search. The 1st character of the
search string is always the second character after the comma.
- 18 -
COMMAND: FLAVOR
ENTRY: <varC> = "FLAVOR fl"
fl: C7 = Clipper, summer 87
C5 = Clipper 5.0
D3 = dBASEIII
D4 = dBASEIV
FB = FoxBase
FP = FoxPro
QS = QuickSilver or dBXL
RETURN: <varC> = unchanged unless error
ERROR CODES:
?f = illegal/missing value for language flavor
SEE ALSO: ONDCD, ONDONE, ONTIME
PURPOSE:
To specify the database language or flavor being used with COMET.
This information is used by COMET internally in situations where
different courses of action need to be taken for certain
languages. Currently, only dBASEIV users need to use this command
as the ON... event trapping commands will not work reliably under
dBASEIV unless the flavor is set to D4. In future versions of
COMET more language specific situations may arise so it is highly
recommended that the proper FLAVOR command be the first command
CALLed.
EXAMPLE:
* Specify dBASEIV flavor
MyFlav = "FLAVOR D4"
CALL COMETMP WITH MyFlav
- 19 -
COMMAND: FLUSH
ENTRY: <varC> = "FLUSH #P"
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
This command performs several actions. First, it always empties
out the COM port receive buffer and clears any paused condition
due to flow control. Secondly, if any type of file transfer is in
progress, it gets canceled. FCHK will report the status as
CANCELED in this instance. This is a simple way to cancel any
active file transfer, regardless of type. Also used to clear the
buffer to a known empty state.
EXAMPLE:
* Start an XModem file send
Send = "XSEND #1,\DBF\SALES.DBF"
* Allow user to cancel file send by hitting ESC key
Flsh = 'FLUSH #1'
ON ESCAPE CALL COMETMP WITH Flsh
SET ESCAPE ON
- 20 -
COMMAND: INPUT
ENTRY: <varC> = "INPUT #P,?????" + SPACE(cnt) [ + CHR(t)]
#P = desired port # (1-5)
cnt = # of chars to get from buffer (maximum)
t = optional input termination character's value
RETURN: <varC> = "INPUT #P,nnnnndd .. d"
nnnnn = # characters read from buffer and returned
dd ..d = COM port data
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer active)
SEE ALSO: OUTPUT, RXCNT
PURPOSE:
To read data from specified COM port's receive data buffer. The
amount of data that will be returned is controlled by several
factors:
1) The length of <varC> determines the maximum number of
characters that can be returned. This amount is limited to
cnt characters if no termination character specified, cnt + 1
if a termination character is specified.
2) If a termination character is specified and this character is
present within the buffer's data, only data upto and including
the termination character will be returned leaving the buffer
pointer at the character following the terminator.
3) If no data is waiting in buffer or all of it has been written
into <varC> without encountering conditions 1 or 2, COMET will
exit the INPUT command.
<varC>'s nnnnn will reflect the number of characters that COMET
has returned. This decimal number will always be 5 digits and
left zero filled immediately followed by the returned data.
EXAMPLE:
* Assume buffer contains: "Hello World" + Cr + Lf
* Let's read just the first 3 chars
RdInp = "INPUT #1,?????" + SPACE(3)
CALL COMETMP WITH RdInp
* RdInp now = "INPUT #1,00003Hel"
Cnt = VAL(SUBSTR(RdInp,10,5)) && Get # chars returned = 3
Data = SUBSTR(RdInp,15,Cnt) && "Hel"
* Now let's find out how many more chars are in buffer and INPUT
* them all.
CntLeft = "RXCNT #1, " && Get count of # chars left in buff
CALL COMETMP WITH CntLeft
* Now CntLeft = "RXCNT #1,00010"
CntLeft = VAL(SUBSTR, CntLeft, 10)
- 21 -
COMMAND: INPUT (cont'd)
* INPUT, specifying a Lf, CHR(10), termination character
RdInp2 = "INPUT #1,?????" + SPACE(CntLeft) +CHR(10)
CALL COMETMP WITH RdInp2
* Now RdInp = "INPUT #1,lo World" + Cr + Lf
- 22 -
COMMAND: MSTAT
ENTRY: <varC> = "MSTAT #P," + SPACE(18)
#P = desired port # (1-5)
RETURN: <varC> = "MSTAT #P,?DCD ?RI ?DSR ?CTS"
? = plus sign (+) if active, minus sign (-) if inactive
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
To determine the state of the four modem status input signals at
the specified COM port. The command always returns the four
signal abbreviations with each one preceded by either a plus or
minus sign to indicate active or not. This command can be called
repetitively to poll the port's status for a desired state, such
as testing for modem connect by waiting for "+DCD" to be returned.
SIGNALS: PIN# 25 PIN CONN 9 PIN CONN
DCD - Data Carrier Detect ............... 8 1
RI - Ring Indicator .................... 22 9
DSR - Data Set Ready .................... 6 6
CTS - Clear To Send ..................... 5 8
EXAMPLE:
* Let's have a modem dial a #
DialCmd = "OUTPUT #1,ATTD555-1212" + CHR(13)
CALL COMETMP WITH DialCmd
* And now we'll wait till DCD goes active indicating our modem
* has connected
MdmStat = "MSTAT #1," + SPACE(18)
DO WHILE .NOT. '+DCD' $ MdmStat && Wait for DCD
CALL COMETMP WITH MdmStat
ENDDO
- 23 -
COMMAND: ONDCD
ENTRY: <varC> = "ONDCD #P,a,x"
#P = desired port # (1-5)
a = key's ASCII code value
Specify 0 if key has no ASCII value (ie. F1)
x = key's auXilary-byte value (see appendix B).
Specify 0 if key has an ASCII value.
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
SEE ALSO: ONDONE, ONTIME, MSTAT
PURPOSE:
This event trap command instructs COMET's background process to
signal the database program whenever a change in the Data Carrier
Detect (DCD) input signal occurs at the specified port. COMET
does this by stuffing a user specified keystroke directly into
DOS's keyboard buffer whenever a transition in the DCD signal
occurs. This keystroke is defined by specifying the key's ASCII
and auxilary byte values (see appendix B). To force the
database program to execute a specific procedure in response to
the DCD event, the program should have previously set up an
appropriate key trap command (ie. ON ESCAPE, ON KEY n, or SET KEY
n). This provides an easy way for a program to automatically jump
to a special procedure whenever a modem connects or disconnects.
Use MSTAT to determine whether DCD is active or inactive.
EXAMPLE:
********* Clipper example code ********************
* Tell Clipper to DO DCDProc if F10 key entered
SET KEY -9 TO DCDProc
* Have COMET stuff F10 key if DCD at port #1 changes
DCDCmd = 'ONDCD #1,0,68' && ASCII & Aux-Byte for F10
CALL COMETMP WITH DCDCmd
******** dBASE, Fox, dBXL or QuickSilver ***********
ON ESCAPE DO DCDProc
SET ESCAPE ON
* Have COMET simulate ESC key if DCD changes at port #1
DCDCmd = 'ONDCD #1,27,0'
CALL COMETMP WITH DCDCmd
* main application code goes here
- 24 -
COMMAND: ONDCD (cont'd)
PROCEDURE DCDProc
* Get current DCD state
COMStat = 'MSTAT #1' + SPACE(18)
CALL COMETMP WITH COMStat && Chk if DCD + or -
IF '+DCD' $ COMStat
DO HaveDCD && A proc that might do file transfers
ELSE
DO LostDCD && A Proc that deals with disconnects
ENDIF
RETURN
NOTE:
To disable DCD event trapping don't specify any key parameters
(ie. <varC> = "ONDCD #1") .
dBASEIV: Set FLAVOR command to D4
CLIPPER USERS: See notes in appendix B
- 25 -
COMMAND: ONDONE
ENTRY: <varC> = "ONDONE #P,a,x"
#P = desired port # (1-5)
a = key's ASCII code value.
Specify 0 if key has no ASCII value (ie. F1)
x = key's auXilary-byte value (see appendix B).
Specify 0 if key has an ASCII value.
RETURN: <varC> = unchanged error
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
SEE ALSO: ONDCD, ONTIME, FCHK
PURPOSE:
This command instructs COMET's background process to signal the
database program whenever a file transfer is done, either due to
normal completion or failure. COMET does this by writing the
ASCII and auxilary bytes values specified directly into DOS's
keyboard buffer. To force the database program to execute a
specific procedure when a file transfer is done, the program
should have previously set up an appropriate key trap command (ie.
ON ESCAPE, ON KEY n, or SET KEY n).
EXAMPLE:
********* Clipper example code ********************
* Tell Clipper to DO DoneProc if S/F10 entered
SET KEY -19 TO DoneProc
* Have COMET simulate S/F10 upon file completion/failure
DoneCmd = 'ONDONE #1,0,93' && ASCII & Aux-Byte for S/F10
CALL COMETMP WITH DoneCmd
******** dBASE, Fox, dBXL or QuickSilver ***********
ON ESCAPE DO DoneProc
SET ESCAPE ON
* Have COMET simulate ESC key upon file completion
DoneCmd = 'ONDONE #1,27,0'
CALL COMETMP WITH DoneCmd
*
* main application code goes here
*
PROCEDURE DoneProc
* Let's disconnect after file transfer is done
HangUp = 'DTR #1,0'
CALL COMETMP WITH HangUp && Modem disconnect
RETURN
NOTE: To disable ONDONE event trapping, don't specify any key
parameters (ie. <varC> = "ONDONE #1").
CLIPPER USERS: See notes in appendix B
dBASEIV: Set FLAVOR to D4
- 26 -
COMMAND: ONTIME
ENTRY: <varC> = "ONTIME t,a,x"
t = time interval in seconds between events
a = key's ASCII code value.
Specify 0 if key has no ASCII value (ie. F1)
x = key's auXilary-byte value (see appendix B).
Specify 0 if key has an ASCII value.
RETURN: <varC> = unchanged unless error
ERROR CODES: (See appendix A for general error codes)
SEE ALSO: ONDCD, ONDONE
PURPOSE:
This command instructs COMET's background process to signal the
database program every t seconds. COMET does this by writing the
ASCII and auxilary bytes values specified directly into DOS's
keyboard buffer. To force the database program to execute a
specific procedure every t seconds, the program should have
previously set up an appropriate key trap command (ie. ON ESCAPE,
ON KEY n, or SET KEY n).
EXAMPLE:
********* Clipper example code ********************
* Tell Clipper to DO TimeProc if S/F10 entered
SET KEY -19 TO TimeProc
* Have COMET simulate S/F10 every 5 seconds
TimeCmd = 'ONTIME 5,0,93' && ASCII & Aux-Byte for S/F10
CALL COMETMP WITH TimeCmd
******** dBASE, Fox, dBXL or QuickSilver ***********
ON ESCAPE DO TimeProc
SET ESCAPE ON
* Have COMET simulate ESC key upon file completion
TimeCmd = 'ONTIME 5,27,0'
CALL COMETMP WITH TimeCmd
*
* main application code goes here
*
PROCEDURE TimeProc
*
* This procedure will execute every 5 seconds
*
RETURN
NOTE: To disable ONTIME event trapping, don't specify any
parameters (ie. <varC> = "ONTIME").
CLIPPER USERS: See notes in appendix B
dBASEIV: Set FLAVOR to D4
- 27 -
COMMAND: OPEN
ENTRY: <varC> = "OPEN COMn[,a,i]:b,p,d,s[,f]"
n = com port # to open ( 1 - 5)
a = optional port hardware I/O address
i = optional port hardware interrupt IRQ# (2-7)
b = baud rate (300 - 38400)
p = parity None, Even or Odd (N, E or O)
d = # data bits (7 or 8)
s = # stop bits (1 or 2)
f = flow control; Xon/Xoff, Rts/cts, or None (X, R or N)
ERROR CODES: (See appendix A for general error codes)
"-" = busy "?p" = invalid parity
"?n" = invalid port # "?f" = invalid flow control
"?a" = invalid address "?d" = invalid # data bits
"?i" = invalid IRQ# "?s" = invalid # stop bits
"?b" = invalid baud rate
PURPOSE:
To prepare or initialize the desired COM port to the specified
settings. A port must be OPEN before other commands can use it.
IMPORTANT:
COMET needs to know several hardware specific details about each
COM port that is to be OPENed. First, it needs to know the base
I/O (input/output) address of the port so COMET knows where to
read and write data from/to. Secondly, COMET needs to know what
interrupt line, or IRQ#, this port will use to "signal" COMET when
the port needs to be serviced. COMET needs to be signaled when
important events occur (ie. a character has just been received or
the port is able to send a character).
If you are using an industry standard COM1 or COM2 as defined by
the table on the following page, you don't need to specify any I/O
address or IRQ# parameters as COMET will use these default values.
While there are industry standards for COM3 and COM4 as far as I/O
addresses, no standard exists as to what IRQ#'s are to be used.
If your COM3 or COM4 conforms to the table below, you need not
specify any address or IRQ# parameters as the defaults will be
used.
If your using non standard COM ports (ie. third party serial
boards like DigiBoard or AST Research), you need to specify the
I/O address and IRQ# parameters in the OPEN command. Note that
while each port must have a unique I/O address, ports can share
the same interrupt IRQ#. This allows multi-port boards that might
have only 1 or 2 interrupt lines to work with COMET. When
specifying these parameters, the actual COM port number parameter,
n, can be any value from 1 to 5.
The COM port number parameter, n, serves two purposes. First, if
no I/O address and IRQ# parameters are present, COMET uses the
default values for the specified port number n based on the table
on the following page. Secondly, it serves a port identifier for
all other COMET commands which need to indicate a port.
- 28 -
COMMAND: OPEN (cont'd)
Default Addresses and Interrupts:
COMn Address (hex) IRQ#
---- ------------- ----
1 x03F8 4
2 x02F8 3
3 x03E8 3
4 x02E8 3
EXAMPLE:
* Let's OPEN port 1 as industry standard COM1 at 2400 baud, no
* parity, 8 data bits, 1 stop bit and no flow control.
OpenCmd = "OPEN COM1:2400,N,8,1,N"
CALL COMETMP WITH OpenCmd
* Let's open port 1 with custom base address of 0100 hex using
* interrupt IRQ #7 and using Xon/xoff flow control.
OpenCmd = "OPEN COM1,x0100,7:2400,N,8,1,X"
NOTE:
While each port OPENed must have a unique I/O address, it may
share the same interrupt IRQ# with upto four other ports allowing
upto five ports to use only one IRQ. Third party multi port
boards will typically only offer 1 or 2 interrupt IRQs for all
their ports to share.
- 29 -
COMMAND: OUTPUT
ENTRY: <varC> = "OUTPUT #P,string"
#P = desired port # (1-5)
string = character(s) to output
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer active)
SEE ALSO: INPUT, TXCNT
PURPOSE:
To output character(s) to the specified serial COM port. If
Xon/xoff or Rts/cts flow control was specified at OPEN time, COMET
will monitor and pause output when receiver sends an Xoff
character or lowers its CTS signal. Use TXCNT command to
determine output status.
EXAMPLE:
* Let's output a dial command to Hayes type modem
OUTCmd = 'OUTPUT #2,ATDT(111)222-3333' + CHR(13)
CALL COMETMP WITH OUTCmd
NOTE:
A null (binary 0) character can't be part of <varC> since its
reserved to indicate or mark the end of character strings in the
database environment. To have COMET output a null, don't specify
any string parameter. eg. <varC> = "OUTPUT #1," will
output a single null character.
- 30 -
COMMAND: RTS
ENTRY: <varC> = "RTS #P,n"
#P = desired port # (1-5)
n = 0 or 1
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
To set the state of the COM port's Request To Send (RTS) output
signal. This signal is set active (1) by default as soon as the
COM port gets OPENed. RTS can also change states if RTS/CTS
handshaking was specified in the OPEN command and the receive
buffer approaches 80% full in which case RTS goes low (0).
Similarily, as the buffer empties to 20% of capacity the RTS
signal will go active (1). The buffer's default capacity is 1024
characters but may be overridden with the BUFFER command.
EXAMPLE:
* Let's turn RTS on and then off at port #3
RTSOn = 'RTS #3,1'
RTSOff = 'RTS #3,0'
CALL COMETMP WITH RTSOn && Set RTS active/on
CALL COMETMP WITH RTSOff && Turn RTS off
- 31 -
COMMAND: RXCNT
ENTRY: <varC> = "RXCNT #P," + SPACE(5)
#P = desired port # (1-5)
RETURN: <varC> = "RXCNT #P,n[nnnn][*]"
n[nnnn] = # bytes waiting in receive buffer
* = buffer overflow indicator
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
To determine how many characters are pending in the receive
buffer. The default capacity of this buffer is 1024 characters
but may be set to any size from 1024 to 65536 bytes. No leading
zeroes or spaces are returned for n. This command is useful when
you want to determine if a certain amount of data has arrived to
the COM port.
If RXCNT returns an asterisk following the count, this is an
indication that the receive buffer for this port has overflowed.
Data has not been INPUT from the port frequently enough to make
room for new incoming data. Try enabling some form of flow
control in the OPEN command to correct this problem.
EXAMPLE:
* Assume that data is sent to port #2 in a block fashion (ie. a
* constant throughput). Let's determine when sender has finished
* sending a block by waiting for RXCNT's value to level off.
* We'll consider 1 second of no received data to indicate end of
* block.
LastRxCnt = GetRxCnt(2) && Init to current cnt in buffer
NoRxSince = SECONDS() && Init secs cntr
DO WHILE SECONDS() - NoRxSince < 1
CurrRxCnt = GetRxCnt(2)
IF CurrRxCnt # LastRxCnt && Compare current RXCNT vs last
NoRxSince = SECONDS() && Got rec'd data, reset secs cntr
LastRxCnt = CurrRxCnt && Update buff cnt
ENDIF
ENDDO
.
.
.
FUNCTION GetRxCnt && dBASEIII should use PROCEDURE stmt
PARAMETERS PortN
PortC = STR(PortN)
GetCnt = "RXCNT #" + PortC + "," + SPACE(5) && Build RXCNT <varC>
CALL COMETMP WITH GetCnt
RETURN VAL(SUBSTR(GetCnt,10)) && Return cnt of # chars in buffer
- 32 -
COMMAND STAT:
ENTRY: <varC> = "STAT #P," + SPACE(3)
#P = desired port # (1-5)
RETURN: <varC> = "STAT #P,???"
? = F, P or O (Framing, Parity or Overrun UART errors)
PURPOSE:
To read the line status of specified port's UART (Universal
Asynchronous Receiver/Transmitter) chip. In simple terms, this
command reports on three classes of hardware detected errors for a
given port #: Framing, Parity and receiver Overrun errors.
Parity errors indicate that the UART has reported one or more
received characters with parity bit errors since the last time the
STAT command was issued. Overrun errors indicate that COMET has
failed to read a received character from the UART before the next
character arrived (ie. overran the UART's internal 1 character
buffer). For further information on UART errors please refer to
technical books on serial communications. COMET clears this error
information every time this STAT command is issued.
EXAMPLE:
UARTStat = "STAT #1, "
CALL COMETMP WITH UARTStat
UARTErrs = SUBSTR(UARTStat,9) && Get error codes, if any
- 33 -
COMMAND: TXCNT
ENTRY: <varC> = "TXCNT #P," + SPACE(5)
#P = desired port # (1-5)
RETURN: <varC> = "TXCNT #P,n[nnnn]"
n[nnnn] = # bytes waiting in receive buffer
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
PURPOSE:
To determine how many characters are pending in the transmit
buffer (non file related only). Since COMET uses the actual
<varC> memory variable for buffering, there is no fixed size or
location for a port's transmit buffer. No leading zeroes or
spaces are returned for n.
- 34 -
COMMAND: VERS
ENTRY: <varC> = "VERS" + SPACE(20)
RETURN: <varC> = "VERS #.##"
#.## is current COMET revision #
PURPOSE:
To get the version and revision level of the COMET library in use.
EXAMPLE:
Version = 'VERS '
CALL COMETMP WITH Version
? 'COMET version in use is: ' + Version
- 35 -
COMMAND: XRECV
ENTRY: <varC> = "XRECV #P,filespec"
#P = desired port # (1-5)
filespec = complete DOS path\filename
RETURN: <varC> = unchanged unless error
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer already active)
SEE ALSO: XSEND, FCHK
PURPOSE:
To start receiving a file using the XMODEM or XMODEM/CRC protocol.
XMODEM/CRC is always attempted first with the sender. Should the
sender not support CRC, this command will fall back to the less
reliable checksum method of error detection. Since XRECV operates
in the background, use FCHK to determine the status of the file
transfer at any time. Since the XMODEM protocol handles the
synchronization of sender and receiver data blocks, no flow
control need be specified when the port is OPENed. Any flow
control specified for port is ignored during the file send
operation.
EXAMPLE:
XmdmRecv = 'XRECV #1,C:\MYDIR\MYFILE.EXT'
CALL COMETMP WITH XmdmRecv && Begin receiving file
*
* Any code here executes at the same time as file is being
received
*
- 36 -
COMMAND: XSEND
ENTRY: <varC> = "XSEND #1,filespec"
#P = desired port # (1-5)
filespec = complete DOS path\filename
RETURN: <varC> = unchanged
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer already active)
PURPOSE:
To begin sending of a file using the XMODEM protocol. This
command supports both CRC and checksum methods of error detection.
The method used will depend on what the receiver requests at the
start of the file transfer. Since this command operates in the
background, use FCHK to obtain the file transfer status at any
time. Any flow control settings for this port are ignored as the
XMODEM protocol handles sender/receiver synchronization.
EXAMPLE:
XmdmSnd = 'XSEND #1,\MYDIR\MYFILE.EXT'
CALL COMETMP WITH XmdmSnd
*
* Any code here executes while file is sent
*
- 37 -
COMMAND: YRECV
ENTRY: <varC> = "YRECV #P"
#P = desired port # (1-5)
RETURN: <varC> = unchanged unless error
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer already active)
PURPOSE:
To begin receiving of a file or group of files using the YMODEM
batch protocol. No filename is required as the YMODEM batch
protocol includes a filename along with data for each file
received. Any files received will be written to the current
directory. Using YMODEM batch is superior to XMODEM for several
reasons. First, the block size is 1024 bytes in YMODEM versus 128
in XMODEM. This larger block size yields a greater transfer rate
than XMODEM. Secondly, YMODEM batch allows the use of DOS
wildcard characters in the filespec parameter. This means a group
of files can be received with one YRECV command, provided that the
sender requested multiple files. Since this command operates in
the background, use FCHK to determine the file transfer status at
any time.
EXAMPLE:
YmdmRecv = 'YRECV #1'
CALL COMETMP WITH YmdmRecv && Begin receiving file(s)
*
* Any code here executes while file(s) are received
*
NOTE: If the sender is using some type of a communications package
such as XTALK or ProCom, make sure it is configured for and
supports the YMODEM batch protocol. Some packages claim YMODEM
capability, yet don't support the batch version.
- 38 -
COMMAND: YSEND
ENTRY: <varC> = "YSEND #P,filespec"
#P = desired port # (1-5)
filespec = DOS path\filespec
RETURN: <varC> = unchanged unless error code
ERROR CODES: (See appendix A for general error codes)
"xx" = port not OPEN
"-" = busy (file transfer already active)
PURPOSE:
To begin sending a file or group of files using the YMODEM batch
protocol. The filespec parameter can include wildcard characters
so that more than one file can be sent within a single command.
Since this command operates in the background, use FCHK to obtain
the file transfer status at any time.
EXAMPLE:
YmdmSnd = 'YSEND \MYDIR\*.DBF'
CALL COMETMP WITH YmdmSnd && Send all files with DBF extension
*
* Any code here executes during file send(s)
*
- 39 -
TROUBLESHOOTING
-----------------
Problem:
After OPENing a port, I can only OUTPUT data to it. RXCNT and
INPUT report 0 characters in buffer:
Solution:
Verify that your hardware uses the default IRQ# assumed by the
OPEN command for COMn. If you've overridden the default IRQ#,
verify its correctness with your serial port's user's manual.
Problem:
Using ARECV or ASEND, some data is lost during the transfer.
Solution:
The receiving PC probably cannot keep pace with the sender causing
the buffer to overflow. Use some form of flow control by
specifying Xon/xoff or Rts/cts in the OPEN command.
Problem:
I am trying to get a HAYES modem to dial a phone number by using
COMET's OUTPUT command to send it a command string. The modem
never seems to go off hook and dial the number.
Solution:
1) HAYES modem will abort commands (including dialing) if you
OUTPUT anything while they are still processing the original
command string you sent. A general rule of thumb is to wait about
1 second between OUTPUTting of modem commands.
2) Did your OUTPUT <varC> end with a CHR(13) as required by all
HAYES style modems? If not, the modem will just sit there idly.
Problem:
I am using FoxPro and sometimes my PC hangs when exiting FoxPro to
DOS.
Solution:
Try disabling expanded memory by putting the following statement
in your CONFIG.FP file:
EMS=OFF
This situation occurs very seldom and only when FoxPro loads the
COMETMP.BIN file into EMS. Upon shutdown, FoxPro releases all EMS
preventing COMET from doing its own shutdown. To avoid this
problem and still be able to use EMS, simply make sure you CLOSE
all COM ports before QUITing from FoxPro. A future release of
COMET will correct this anomaly.
- 40 -
APPENDIX A - ERROR CODES
After CALLing COMETMP with a character type variable, <varC>,
COMETMP will return any error information by replacing the first
one or two characters of <varC> with an error code from the
following list:
CODE ERROR DESCRIPTION
---- ----------------------------------------------------
? Command name syntax error. Unknown command requested.
?# Illegal/missing port #.
?, Required comma delimiter missing.
?? Command requires parameters but none were found.
xx Port # specified is not currently OPENed.
- Specified port is busy at this time. Probably due to
a file transfer that is still active.
?l Bad or missing parameter l.
eg. CALLing COMETMP WITH "OPEN COM8:2400,N,8,1" for
<varC> will return a "?n" error code indicating a bad
parameter n for the OPEN command.
- 41 -
Appendix B: Auxilary-Byte Table
-------------------------------
Value Key Value Key Value Key
----- ------- ----- ------- ----- ---------
59 F1 110 Alt-F7 44 Alt-Z
60 F2 111 Alt-F8 45 Alt-X
61 F3 112 Alt-F9 46 Alt-C
62 F4 113 Alt-F10 47 Alt-V
63 F5 48 Alt-B
64 F6 120 Alt-1 49 Alt-N
65 F7 121 Alt-2 50 Alt-M
66 F8 122 Alt-3
67 F9 123 Alt-4 15 Shift-Tab
68 F10 124 Alt-5
125 Alt-6 71 Home
84 Shift-F1 126 Alt-7 72 Up Arr
85 Shift-F2 127 Alt-8 73 PgUp
86 Shift-F3 128 Alt-9
87 Shift-F4 129 Alt-0 75 Left Arr
88 Shift-F5 130 Alt-Hyphen
89 Shift-F6 131 Alt-= 77 Right Arr
90 Shift-F7
91 Shift-F8 16 Alt-Q 79 End
92 Shift-F9 17 Alt-W 80 Down Arr
93 Shift-F10 18 Alt-E 81 PgDn
19 Alt-R 82 Insert
94 Ctrl-F1 20 Alt-T 83 Delete
95 Ctrl-F2 21 Alt-Y
96 Ctrl-F3 22 Alt-U 114 Ctrl-PrtSc
97 Ctrl-F4 23 Alt-I 115 Ctrl-Lft
98 Ctrl-F5 24 Alt-O 116 Ctrl-Rgt
99 Ctrl-F6 25 Alt-P 117 Ctrl-End
100 Ctrl-F7 118 Ctrl-PgDn
101 Ctrl-F8 30 Alt-A 119 Ctrl-Home
102 Ctrl-F9 31 Alt-S
103 Ctrl-F10 32 Alt-D 132 Ctrl-PgUp
33 Alt-F
104 Alt-F1 34 Alt-G
105 Alt-F2 35 Alt-H
106 Alt-F3 36 Alt-J
107 Alt-F4 37 Alt-K
108 Alt-F5 38 Alt-L
109 Alt-F6
- 42 -
Appendix C: CLIPPER EVENT TRAPPING
----------------------------------
Using Clipper's SET KEY n TO procedure command in conjunction with
any of COMET's event trapping commands may produce some
undesirable side effects. The problem becomes evident when an
ONDCD, ONDONE or ONTIME event occurs during a full screen READ
operation. Clipper detects the keyboard character produced by the
ONxxxx event and branches to the SET KEY procedure without a
problem. However, upon RETURNing to the READ's active GET field,
the cursor position always gets forced to the field's leftmost
(home) position. The cursor would appear to suddenly jump every
time an event occurred. It is recommended that the following code
be put inside the SET KEY procedure to alleviate this problem. It
takes advantage of the READVAR() parameter that is automatically
passed to any SET KEY procedure.
PROCEDURE WhatEver
PARAMETERS Proc, Line, Var && Automatically passed
*
* Place desired event code here
*
* Cursor fix code
IF LEN(Var) > 0 && Is a GET/READ in effect ?
PosnInGet = LEN(&Var) && Determine position
* Stuff right arr's to restore this position
KEYBOARD REPLICATE(CHR(4), PosInGet)
ENDIF
RETURN && Exit SET KEY procedure
- 43 -